package com.g2.admin.common.constant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

public class Constants {
    public static final String COMMA_CH = "，";
    public static final String COMMA_EN = ",";
    public static final String DOT = ".";
    public static final String HORIZONTAL_LINE = "-";
    public static final String UNDERSCORE = "_";
    public static final String CODE_GBK = "GBK";
    /**
     * 令牌中用户ID
     */
    public static final String TOKEN_USER_ID = "user_id";
    public static final String TOKEN_USER_NAME = "user_name";
    public static final String TOKEN_USER_AVATAR = "user_avatar";
    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";
    public static final String TOKEN_HEADER = "Authentication";
    /**
     * 验证码类型
     */
    public static final String CAPTCHA_MATH = "math";
    public static final String CAPTCHA_CHAR = "char";


    /**
     * 登录类型
     */
    public enum LoginType implements IEnum<Integer> {
        LOGIN(1, "登录"), LOGOUT(2, "登出"), LOGOUT_AUTO(3, "自动登出");
        @EnumValue
        private final int code;
        @JsonValue
        private final String alias;

        LoginType(int code, String alias) {
            this.code = code;
            this.alias = alias;
        }

        public int getCode() {
            return code;
        }

        public String getAlias() {
            return alias;
        }

        @Override
        public Integer getValue() {
            return code;
        }
    }
}
